// pages/movieDetail/movieDetail.js
const http = require("../../models/http")
const {transformStart,handleTitle} = require("../../utils/index")
Page({
  data: {
    value:"",
    isPlay:false,
    star:""
  },
  onLoad: function (options) {
    console.log(options);
    http({
      url:`http://localhost:8081/subject/${options.id}`,
      success: (res)=> {
        this.setData({
          value:res.data
        })
        this.handleHttpData(res.data)
        console.log(this.data.value);
        // console.log(this.data.value);
      }
    })
  },
  handOpen(){
    this.setData({
      isPlay:!this.data.isPlay
    })
  },
  handleHttpData(res){
    res.star = transformStart(res.rating_num)
    this.setData({
      value:res
    })
    console.log(this.data.value);
  },
})